package run.siyuan;

import net.rubyeye.xmemcached.MemcachedClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import run.siyuan.util.MemcachedUtil;

import javax.annotation.PostConstruct;

@SpringBootApplication
public class MemcachedApplication {

    @Autowired
    private ApplicationContext applicationContext;

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(MemcachedApplication.class, args);
    }

    @PostConstruct
    public void init(){
        MemcachedClient memcachedClient = applicationContext.getBean(MemcachedClient.class);
        MemcachedUtil.setMemcachedClient(memcachedClient);
    }



}